#include <sqlpp11/table.h>
#include <sqlpp11/data_types.h>
#include <sqlpp11/char_sequence.h>

#define DELARE_FIELD(field,type)\
struct field { \
	struct _alias_t { \
		static constexpr const char _literal[] = #field; \
		using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;\
		template<typename T>\
			struct _member_t {\
				T field;\
				T& operator()() { return field; }\
				const T& operator()() const { return field; }\
			};\
	};\
	using _traits = sqlpp::make_traits<type>;\
	static constexpr const char* ColName = _alias_t::_literal;\
};\
namespace Field { \
	static constexpr const char* field = field::_alias_t::_literal;\
}\

namespace MyTab
{
	DELARE_FIELD(gid, sqlpp::integer)
	DELARE_FIELD(name,sqlpp::text)
	DELARE_FIELD(desc,sqlpp::text)
		
	struct table_Project : sqlpp::table_t<table_Project
	, gid, name, desc> {
	struct _alias_t {
			static constexpr const char _literal[] = "Project";
			using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
			template<typename T> struct _member_t {
				T _tab;
				T& operator()() {
					return _tab;
				} const T& operator()() const {
					return _tab;
				}
			};
		};
	};
	
	DELARE_FIELD(x, sqlpp::floating_point)
	DELARE_FIELD(y, sqlpp::floating_point)
	DELARE_FIELD(z, sqlpp::floating_point)
	DELARE_FIELD(pid, sqlpp::text)
	DELARE_FIELD(project, sqlpp::text)
	DELARE_FIELD(projectType, sqlpp::text)
	DELARE_FIELD(time, sqlpp::text)
	struct table_ObserveData : sqlpp::table_t<table_ObserveData
		, gid, pid, time, x, y, z, project, projectType, desc> {
		struct _alias_t {
			static constexpr const char _literal[] = "ObserveData";
			using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
			template<typename T> struct _member_t {
				T _tab;
				T& operator()() {
					return _tab;
				} const T& operator()() const {
					return _tab;
				}
			};
		};
	};

	struct table_GeoObserve : sqlpp::table_t<table_GeoObserve
		, gid, time, desc> {
		struct _alias_t {
			static constexpr const char _literal[] = "GeoObserve";
			using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
			template<typename T> struct _member_t {
				T _tab;
				T& operator()() {
					return _tab;
				} const T& operator()() const {
					return _tab;
				}
			};
		};
	};
}